cmake_minimum_required(VERSION 2.8)

project(dicom C CXX)
DEPS_DIR

if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "debug")
endif()

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
include(mergestaticlibs)

SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fPIC -g -Wall -std=c++0x -D_FILE_OFFSET_BITS=64")
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_CXX_FLAGS_DEBUG "-O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -finline-limit=1000 -DNDEBUG")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_BINARY_DIR})

find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})

if (NOT DEPS_DIR)
    set (DEPS_DIR ${PROJECT_SOURCE_DIR}/../)
endif()

# json library
if (NOT JSONCPP_DIR)
    set(JSONCPP_DIR ${DEPS_DIR}/jsoncpp)
endif()
include_directories(${JSONCPP_DIR}/include)
add_library(jsoncpp_static STATIC IMPORTED)
set_property(TARGET jsoncpp_static PROPERTY
    IMPORTED_LOCATION
    ${JSONCPP_DIR}/build/src/lib_json/libjsoncpp_static.a)

add_subdirectory(gwbase)
add_subdirectory(gwlib)
